package dao;

import org.apache.ibatis.annotations.*;
import pojo.DoctorFee;

import java.util.List;

public interface DoctorFeeMapper {

    @Select("SELECT * FROM doctorfee")
    @Results({
            @Result(column = "fee_id", property = "feeId"),
            @Result(column = "fee_name", property = "feeName"),
            @Result(column = "update_time", property = "updateTime"),
            @Result(column = "money", property = "money"),
            @Result(column = "status", property = "status")
    })
    List<DoctorFee> findAll();

    @Select("SELECT * FROM doctorfee WHERE fee_id = #{feeId}")
    @Results({
            @Result(column = "fee_id", property = "feeId"),
            @Result(column = "fee_name", property = "feeName"),
            @Result(column = "update_time", property = "updateTime"),
            @Result(column = "money", property = "money"),
            @Result(column = "status", property = "status")
    })
    DoctorFee findById(int feeId);

    @Insert("INSERT INTO doctorfee(fee_name, money, update_time, status) " +
            "VALUES(#{feeName}, #{money}, #{updateTime}, #{status})")
    int addFee(DoctorFee fee);

    @Update("UPDATE doctorfee SET " +
            "fee_name = #{feeName}, " +
            "money = #{money}, " +
            "update_time = #{updateTime}, " +
            "status = #{status} " +
            "WHERE fee_id = #{feeId}")
    int updateFee(DoctorFee fee);

    @Delete("DELETE FROM doctorfee WHERE fee_id = #{feeId}")
    int deleteFee(int feeId);
}